package com.example.phpclient.student;

import android.os.Bundle;
import android.util.Log;
import android.widget.RadioGroup;

import com.example.phpclient.R;
import com.example.phpclient.fragment.fragmen_rl;
import com.example.phpclient.fragment.fragment_qd;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

public class QdStudent_activity extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.stu_qd);

        FragmentManager manager =getSupportFragmentManager();
        FragmentTransaction transaction = manager.beginTransaction();
        transaction.replace(R.id.content_layout,new fragment_qd());//打开签到就先把fragment_rl加载出来
        transaction.commit();
        initView();
    }

    private void initView() {
        RadioGroup RGtables =(RadioGroup)findViewById(R.id.rdb_tabs);
        RGtables.setOnCheckedChangeListener(new MyOnCheckedChangedListener());
    }
        class MyOnCheckedChangedListener implements RadioGroup.OnCheckedChangeListener {
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                FragmentManager manager = getSupportFragmentManager();
                FragmentTransaction transaction = manager.beginTransaction();
                switch (checkedId){
                    case R.id.rdb_qd:
                        transaction.replace(R.id.content_layout,new fragment_qd());
                        transaction.commit();
                        break;
                    case R.id.rdb_rl:
                        transaction.replace(R.id.content_layout,new fragmen_rl());
                        transaction.commit();
                        break;
                }

            }
        }

    }

